function calendar(t) {
	var sPath = "class/calendar/calendar1.htm";
	strFeatures = "dialogWidth=206px;dialogHeight=208px;center=yes;help=no;status=no";
	var st = t.value;
	sDate = showModalDialog(sPath, st, strFeatures);
	if (sDate) t.value = formatDate(sDate);
}

function checkDate(t) {
	dDate = new Date(t.value);
	if (dDate == "NaN") {t.value = ""; return;}
	iYear = dDate.getFullYear()
	if ((iYear > 1899)&&(iYear < 1950)) {
		sYear = "" + iYear + ""
		if (t.value.indexOf(sYear,1) == -1) {
			iYear += 100
			sDate = (dDate.getMonth() + 1) + "-" + dDate.getDate() + "-" + iYear
			dDate = new Date(sDate)
		}
	}
	t.value = formatDate(dDate);
}

function formatDate(sDate) {
	var sScrap = "";
	var dScrap = new Date(sDate);
	if (dScrap == "NaN") return sScrap;
	
	iDay = dScrap.getDate();
	iMon = dScrap.getMonth();
	iYea = dScrap.getFullYear();

	sScrap = iYea + "-" + d2(iMon + 1) + "-" + d2(iDay) ;
	return sScrap;
}

function d2(d) {
	return ((d<10) ? "0"+d : d) ;
}